package tool

import (
	"time"

	"github.com/zeromicro/go-zero/core/collection"
	"github.com/zeromicro/go-zero/core/logx"
)

type StopTimingWheelFunc = func()

func MustNewTimingWheel(interval time.Duration, numSlots int, execute collection.Execute) (*collection.TimingWheel, StopTimingWheelFunc) {
	tw, err := collection.NewTimingWheel(interval, numSlots, execute)
	logx.Must(err)
	return tw, tw.Stop
}
